﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Configuration;

namespace BOMS.DBUtility
{
  public  class DbHelper
    {
      public static string DBType = ConfigurationManager.AppSettings["DBType"];

      public static DataTable Rt_Table(string str_Sqldt)
      {
          DataTable dt = new DataTable();
          if (DBType == "MySql")
          {
              dt = DbHelperMySql.Rt_Table(str_Sqldt);
          }
          else if (DBType == "MsSql")
          {
              dt = DbHelperSQL.Rt_Table(str_Sqldt);
          }
          return dt;

      }

      public static DataSet Query(string SQLString)
      {
          DataSet ds = new DataSet();
          if (DBType == "MySql")
          {
              ds = DbHelperMySql.Query(SQLString);
          }
          else if (DBType == "MsSql")
          {
              ds = DbHelperSQL.Query(SQLString);
          }
          return ds;
      }

      public static int ExecuteSql(string SQLString)
      {
          int count = 0;
          if (DBType == "MySql")
          {
              count = DbHelperMySql.ExecuteSql(SQLString);
          }
          else if (DBType == "MsSql")
          {
              count = DbHelperSQL.ExecuteSql(SQLString);
          }
          return count;
      }
      public static object GetSingle(string SQLString)
      {
          object obj = new object();
          if (DBType == "MySql")
          {
              obj = DbHelperMySql.GetSingle(SQLString);
          }
          else if (DBType == "MsSql")
          {
              obj = DbHelperSQL.GetSingle(SQLString);
          }
          return obj;
      }







    }
}
